export function createErrorResponse(message: string, status: number): Response {
  return new Response(
    JSON.stringify({
      success: false,
      error: message,
    }),
    {
      status: status,
      headers: { 'content-type': 'application/json' },
    }
  );
}

export function handleError(error: unknown): Response {
  console.error('Error:', error);
  return createErrorResponse(
    error instanceof Error ? error.message : 'Internal server error',
    500
  );
}